﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using NC.Cather;
using NC.Infrastructure.Domain;

namespace NC.Infrastructure.Data
{
    public interface IRepository<TEntity> where TEntity:BaseEntity
    {
        void Insert(TEntity entity);
        void Insert(IEnumerable<TEntity> entities);
        void Delete(TEntity entity);
        void Delete(IEnumerable<TEntity> entities);
        void Update(TEntity entity);
        void Update(IEnumerable<TEntity> entities);
        TEntity Get(object id);
        IQueryable<TEntity> Get(Expression<Func<TEntity, bool>> filter);
        IQueryable<TResultEntity> Get<TResultEntity>(Expression<Func<TEntity, bool>> filter, Expression<Func<TEntity, TResultEntity>> select);
        int Commit();
        IQueryable<TEntity> Entities { get; }
    }
}
